package com.example.merchant;

public class MerChant {
    //public String name; //优惠劵名字
    //public String type;//优惠劵类型

   // public String name;//用户姓名
    public String sex;//用户性别
    public int age;//用户年龄
    public int sum;//用户总数

//    public void setType(){//设置优惠劵名字
//        type =type;
//    }
    public void setSex(){ //设置用户性别
        sex =sex;
    }
    public void setAge(){ //设置用户年龄
        age =age;
    }
    public void setSum(){ //设置总人数
        sum =sum;
    }


    public void faFang1(){
        if (age<=18&& sex.equals("女")) {
            System.out.println("发放优惠卷A给用户");
        }else {
            System.out.println("用户不满足优惠劵A发放条件");
        }
    }
    public void faFang2(){
        int x=1;
        while (x<=sum/2){
        System.out.println("发放优惠劵B给用户");
        if (x==sum/2){
            System.out.println("优惠劵B已发完");
        }
        x++;
        }
    }

    public static void main(String[] args){
        MerChant merChantA =new MerChant();
        MerChant merChantB =new MerChant();
        MerChant merChantC =new MerChant();
       // merChantA.type ="优惠劵A";
        merChantA.age =10;
        merChantA.sex ="女";
        merChantA.faFang1();
        merChantB.sum =4;
        merChantB.faFang2();
        merChantC.age=19;
        merChantC.sex="女";
        merChantC.faFang1();


    }
}
